 |
 |
 |
 |
#277418 - 07/30/04 08:22 AM
Finished-[6.3] Enable 'Badwords' Filtering For Member Profiles & User List
|
Code Monkey
Registered: 09/26/03
Posts: 524
|
Mod Name / Version: Enable 'Badwords' Filtering For Member Profiles & User List <br /> <br /> Description: This will enable badwords filtering in <br /> both a member's profile page & the user list in order to <br /> help prevent spamming (used to increase search engine rankings). <br /> <br />After you find a user who is engaging in spamming, simply <br /> add their spammed URL to your badwords filter list and all <br /> profiles & the user list will automatically censor it. <br /> <br />** IMPORTANT: The badwords URL MUST be in the format: www.example.com <br />DO NOT ADD HTTP:// to it. <br /> <br />NOTE: This is specifically for v6.3, and I'm not entirely <br /> sure if the changes will work correctly for newer versions, <br /> although I think they should. <br /> <br />(the 'FIND THIS:' sections may be a li'l <br /> different though, although that part will be easy to find <br /> anyway). <br /> <br />Feel free to post any updates in this thread for v6.4 & v6.5, if necessary. <br /> <br /> Working Under: UBB.Threads 6.3 <br /> <br /> Mod Status: Finished <br /> <br /> Any pre-requisites: <br /> <br /> Author(s): Twisty <br /> <br /> Date: 07/30/04 <br /> <br /> Credits: AllenAyres & Joshpet for initiating the idea <br /> <br /> Files Altered: <br /> <br />showprofile.php <br />showmembers.php <br /> <br /> New Files: <br /> <br /> Database Altered: no <br /> <br /> Info/Instructions: <br /> <br />[STEP 1] In showprofile.php... <br /> <br />FIND THIS: <br /> <br /> // ---------------- <br />// Assign the stuff <br /> list ($CheckUser,$Fakeemail,$Name,$Totalposts,$Homepage,$Occupation,$Hobbies,$Location,$Bio,$ICQ,$Extra2,$Extra3,$Extra4,$Extra5,$Registered,$Picture,$Title,$Userstatus,$UNumber,$Rating,$Rates,$width,$height,$coppauser,) = $dbh -> fetch_array($sth); <br /> $dbh -> finish_sth($sth); <br /> <br />ADD AFTER IT, THIS: <br /> <br /> // --------------------------------------------------------------------- <br />// Substitute any filters/badwords with the $config[censored] variable <br /> $words[0] = ""; <br /> if ($config['censored']) { <br /> $badwords = @file("{$config['path']}/filters/badwords"); <br /> if (!is_array($badwords)) { <br /> $badwords = @file ("{$config['phpurl']}/filters/badwords"); <br /> } <br /> while (list($linenum,$line) = each($badwords) ) { <br /> $line = chop($line); <br /> if ( (preg_match("/^\r/",$line)) || (preg_match("/^\n/",$line)) ) { <br /> continue; <br /> } <br /> $islines = 1; <br /> $words[count($words)] = $line; <br /> // PHP4 ONLY <br /> // array_push ($words, $line); <br /> } <br /> if ($islines) { <br /> $badwords = join("|", $words); <br /> $badwords = preg_replace("/^\|/","",$badwords); <br /> <br /> $Homepage = preg_replace("/\b($badwords)\b/i",$config['censored'],$Homepage); <br /> $Fakeemail = preg_replace("/\b($badwords)\b/i",$config['censored'],$Fakeemail); <br /> $Name = preg_replace("/\b($badwords)\b/i",$config['censored'],$Name); <br /> $Occupation = preg_replace("/\b($badwords)\b/i",$config['censored'],$Occupation); <br /> $Hobbies = preg_replace("/\b($badwords)\b/i",$config['censored'],$Hobbies); <br /> $Location = preg_replace("/\b($badwords)\b/i",$config['censored'],$Location); <br /> $Bio = preg_replace("/\b($badwords)\b/i",$config['censored'],$Bio); <br /> $ICQ = preg_replace("/\b($badwords)\b/i",$config['censored'],$ICQ); <br /> $Extra2 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra2); <br /> $Extra3 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra3); <br /> $Extra4 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra4); <br /> $Extra5 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra5); <br /> $Title = preg_replace("/\b($badwords)\b/i",$config['censored'],$Title); <br /> } <br /> } <br /> <br /> <br />[STEP 2] In showmembers.php... <br /> <br />FIND THIS: <br /> <br /> // ---------------------------------------------------------------- <br />// Cycle through the users <br /> for($i=0;$i<$total;$i++){ <br /> <br /> list ($Username,$Reged,$ICQ,$Home,$Posts,$Status,$Uid) = $dbh -> fetch_array($sth); <br /> <br />ADD AFTER IT, THIS: <br /> <br /> // --------------------------------------------------------------------- <br />// Substitute any filters/badwords with the $config[censored] variable <br /> $words[0] = ""; <br /> if ($config['censored']) { <br /> $badwords = @file("{$config['path']}/filters/badwords"); <br /> if (!is_array($badwords)) { <br /> $badwords = @file ("{$config['phpurl']}/filters/badwords"); <br /> } <br /> while (list($linenum,$line) = each($badwords) ) { <br /> $line = chop($line); <br /> if ( (preg_match("/^\r/",$line)) || (preg_match("/^\n/",$line)) ) { <br /> continue; <br /> } <br /> $islines = 1; <br /> $words[count($words)] = $line; <br /> // PHP4 ONLY <br /> // array_push ($words, $line); <br /> } <br /> if ($islines) { <br /> $badwords = join("|", $words); <br /> $badwords = preg_replace("/^\|/","",$badwords); <br /> <br /> $Home = preg_replace("/\b($badwords)\b/i",$config['censored'],$Home); <br /> $ICQ = preg_replace("/\b($badwords)\b/i",$config['censored'],$ICQ); <br /> } <br /> } <br /> <br /> <br />:-) <br /> <br /> Disclaimer: Please backup every file that you intend to modify. <br />If the modification modifies the database, it's a good idea to backup your database before doing so. <br /> <br />Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
_________________________
Twisty []http://www.mameworld.info/misc/nana2.gif[/] MAMEWorld
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|